package com.unionfetch.content_home.presenter

import com.unionfetch.content_home.bean.request.UploadKYCFile
import com.unionfetch.content_home.contract.AccountContract
import com.unionfetch.content_home.contract.KYCContract
import com.unionfetch.content_home.model.KYCAuthModel
import com.unionftech.common.base.mvp.IBaseView
import com.unionftech.common.base.mvp.impl.BasePresenter
import com.unionftech.common.base.mvp.impl.IBaseCallBack
import com.unionftech.common.bean.ResponseResult

class KYCPresenter : BasePresenter<IBaseView, KYCAuthModel>(), KYCContract.IKYCPresenter {
    override fun uploadPoi(token: String, kycFile: UploadKYCFile, isSupplement: Boolean) {
        getView()?.showLoading()
        getModel().uploadPoi(token, kycFile, isSupplement,
            object : IBaseCallBack<ResponseResult<Any?>> {
                override fun onResponse(response: ResponseResult<Any?>) {
                    getView()?.hideLoading()
                    getView()?.let {
                        if (it is KYCContract.IUploadPoiView) {
                            it.handleUploadPoi(response)
                        }
                    }
                }
            })
    }

    override fun uploadPoa(token: String, kycFile: UploadKYCFile, isSupplement: Boolean) {
        getView()?.showLoading()
        getModel().uploadPoa(token, kycFile, isSupplement,
            object : IBaseCallBack<ResponseResult<Any?>> {
                override fun onResponse(response: ResponseResult<Any?>) {
                    getView()?.hideLoading()
                    getView()?.let {
                        if (it is KYCContract.IUploadPoaView) {
                            it.handleUploadPoa(response)
                        }
                    }
                }
            })
    }
}